<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../inc/conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="<%=jianbook.sysinfo("keyword")%>" />
<meta name="description" content="<%=jianbook.sysinfo("dsc")%>" />
<title><%=jianbook.sysinfo("title")%>—Powered by 9416.cn</title>

<link href="../ui/images/main.css" rel="stylesheet" type="text/css" />
<link href="../ui/layui/css/layui.css" rel="stylesheet" type="text/css" />
    
</head>


<body style="background:#FFF">
<%
'''jianbook 
''' ==================================================================
''' 版权所有 http://www.9416.cn
''' ------------------------------------------------------------------
''' 此程序为免费开源版，个人可免费自由使用，不得作为商业用途，不可以修改再次发布！
''' ------------------------------------------------------------------
''' 个人使用需要保留版权，如需去除版权请联系作者购买。
''' ==================================================================

dim a_id

a_id=0

if trim(request("id"))<>"" and IsNumeric(request("id")) then
sql="select * from comment where id="&request("id")
rs.open sql,conn,1,1
if not rs.eof then
a_title=rs("name")
a_id=rs("id")
a_con=rs("content")
a_file=rs("file")
a_pic=rs("pic")
a_lm=rs("lm")
end if
rs.close



end if

%>

<!--发布信息-->
<div class="c_form" id="c_div"   >
  <form id="cform" name="cform" method="post" >
  <div class="f_form">


<div class="layui-upload">
    
  <div class="file-div"  style="left:460px;top:25px;" >
<%if trim(a_file)<>"" then%>
<div class="upload-file"><%=a_file%><input type="hidden" name="fujian" value="<%=a_file%>"><div class="file-close" onclick="fjclose(this)">×</div></div>
<%end if%>
</div>
<div class="upload-div" style="display:block;bottom:10px; ">
<%if trim(a_pic)<>"" then
sp_pic=split(a_pic,",")
for i=0 to ubound(sp_pic)
%>
<div class="upload-img"><img src="../<%=trim(sp_pic(i))%>" width="80" height="80"><input type="hidden" name="pic" value="<%=trim(sp_pic(i))%>"><div class="upload-close" onclick="picclose(this)">×</div></div>
<%next
end if%>
</div>


<div class="file iconfont icon-fujian1"  style="left:440px;top:20px;" ></div>
<div class="upload layui-icon layui-icon-picture " style="left:390px;top:20px;"></div>
<input type="hidden" name="class" value="1"  />
 <input type="hidden" name="id" value="<%=a_id%>"  />
 <input type="hidden" name="upid" value="0"  />
<input type="hidden" name="plat" value="pc"  />
   
</div>
<div class="ftitle" style="margin-top:20px;"> 

    <input name="name" type="text" class="layui-input"  placeholder="输入标题" maxlength="50" lay-verify="required" value="<%=a_title%>"/>
 </div>
<div style="position:absolute;top:70px;right:10px;left:10px;bottom:150px;" lay-ignore>
 <%if jianbook.sysinfo("ubbtype")=1  then%>
 <script id="editor" name="content" type="text/plain" style="width:100%;height:100%;"><%=a_con%></script>
<%else%>
 <div id="test-editormd" >
     <textarea name="content" style="display:none;" ><%=a_con%></textarea>
            </div>
 <%end if%>
</div>
<div class="f_type layui-form" style="top:19px;right:10px">
<select name="lm" class="lm">
  <option value="">选择分类</option>
 	<%
	if request.Cookies("admin")("login")="true" then
	Sql="select * from [type] order by  num asc,id desc"
	else
	Sql="select * from [type] where iscomment=1 order by  num asc,id desc"
	end if
	
rs.open Sql,conn,3,3
	if not rs.eof then
	do while not rs.eof
%>
 <option value="<%=rs("title")%>" <%if a_lm=rs("title") then%> selected="selected"<%end if%>><%=rs("title")%></option>
<%
rs.movenext
loop
end if
rs.close%>
 
</select>

</div>

    <div class="f_txt " style="z-index:100;">
    
   <input type="button" name="button2"  value="确认提交" class="mes_btn" lay-submit="lay-submit"  lay-filter="submit"  />
    </div>
      
  </div>
  <div class="jianbook_cor" ><%=jianbook.cor%></div>
  
  </form>
</div>



<script type="text/javascript" src="../ui/jquery.js"></script>
<script type="text/javascript" src="../ui/layui/layui.js"></script>
<script type="text/javascript" src="../ui/jq.js"></script>
<script type="text/javascript" src="../ui/pc.js"></script>
<%if jianbook.sysinfo("ubbtype")=1  then%>
  <script type="text/javascript" charset="utf-8" src="../upload/ue/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="../upload/ue/ueditor.all.js"> </script>
 <script type="text/javascript">
 var ue = UE.getEditor('editor', {
   toolbars: [[
             'source', '|', 'undo', 'redo', '|',
            'bold',  'removeformat', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
            'paragraph', 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 
            'link', 'unlink', '|',
            'simpleupload', 'insertimage',  'map', 'insertcode',    '|',
            'horizontal',  'wordimage', '|',
            'inserttable'
        ]], 
		
	maximumWords:3000,
    autoHeightEnabled: true,
    autoFloatEnabled: true,
	xssFilterRules: false 
});
</script>
<%else%>

<link rel="stylesheet" href="editor/css/editormd.css" />
<script src="editor/editormd.min.js"></script>
<script type="text/javascript">
 var testEditor;
 
            $(function() {
                testEditor = editormd("test-editormd", {
                    width   : "100%",
                    height  :"100%",
					placeholder:'本编辑器支持Markdown编辑，左边编写，右边预览', 
                    syncScrolling : "single",
                    path    : "editor/lib/",
					
					 //codeFold : true,
                        //syncScrolling : false,
                        saveHTMLToTextarea : true,    // 保存 HTML 到 Textarea
                        searchReplace : true,
                        //watch : false,                // 关闭实时预览
                        //htmlDecode : "style,script,iframe|on*",            // 开启 HTML 标签解析，为了安全性，默认不开启    
                        //toolbar  : false,             //关闭工具栏
                        //previewCodeHighlight : false, // 关闭预览 HTML 的代码块高亮，默认开启
                        emoji : true,
                        taskList : true,
                        tocm            : true,         // Using [TOCM]
                        tex : true,                   // 开启科学公式TeX语言支持，默认关闭
                        flowChart : true,             // 开启流程图支持，默认关闭
                        sequenceDiagram : true,       // 开启时序/序列图支持，默认关
					
					toolbarIcons : function() {
        
            // Using "||" set icons align right.
           return ["undo", "redo", "|","quote", "del","bold", "hr", "|", "h1", "h2","h3", "h4",  "|", "list-ol","emoji", "link","reference-link", "image","code-block",  "table", "pagebreak", "||", "watch", "preview", "info"]
        },
		 
		
		 imageUpload : true,
                    imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
                    imageUploadURL : "../upload/index.asp?act=md",
                });
		
                
                
            });
			</script>

<%end if%>
<script>
   
   
   layui.use(['layer','form','laydate','upload','element'], function(){ 
  var  layer = layui.layer; 
   var form = layui.form;
    var element = layui.element;
   var laydate = layui.laydate;
 var device = layui.device();
 var upload = layui.upload	  
	
		upload.render({
    elem: '.upload'
    ,url: '../upload/index.asp'
	 ,multiple: true
	,number:4
    ,before: function(obj){
	layer.load(); 
    }
    ,done: function(res){
		  layer.closeAll('loading');
      //如果上传失败
      if(res.code > 0){
        return layer.msg(res.msg);
      }
      //上传成功
	    if(res.code == 0){
		
	var item=this.item
		console.log(item)
		item.parent(".layui-upload").find(".upload-div").show(500)
	
	item.parent(".layui-upload").find(".upload-div").append("<div class='upload-img'><img src=../"+res.data["src"]+" width=80 height=80><input type='hidden' name='pic' value="+res.data["src"]+"  /><div class='upload-close' onclick='picclose(this)'>×</div></div>");
		
	
        return layer.msg(res.msg);
		
      }
    }
    ,error: function(){
		  layer.closeAll('loading');
      //演示失败状态，并实现重传
     return layer.msg('上传失败');
    
    }
  })
	
 upload.render({
    elem: '.file'
    ,url: '../upload/file.asp'
	,accept: 'file'
    ,before: function(obj){
	layer.load(); 
    }
    ,done: function(res){
		  layer.closeAll('loading');
      //如果上传失败
      if(res.code > 0){
        return layer.msg(res.msg);
      }
      //上传成功
	    if(res.code == 0){
		
	var item=this.item
		
	item.parent(".layui-upload").find(".file-div").show(500)

	item.parent(".layui-upload").find(".file-div").html('<div class=upload-file>'+res.data["src"]+"<input type='hidden' name='fujian' value="+res.data["src"]+"  /><div class='file-close' onclick='fjclose(this)'>×</div></div>");
	
        return layer.msg(res.msg);
		
      }
    }
    ,error: function(){
		  layer.closeAll('loading');
      //演示失败状态，并实现重传
     return layer.msg('上传失败');
    
    }
  });

   

  
form.on('submit(submit)', function () {
var jianbook=$(".jianbook_cor").html()

var title=$("input[name=name]").val()

var content=$("textarea[name=content]").val()

console.log(content,content.length)
if (!/^.{2,50}$/.test(title)){
	
	layer.msg("标题为2-50个字符")
	
	return false;
	
	
	}

if (content.length<10){
	layer.msg("文章详情必须大于10个字符")
	return false;
	}

var jianbook=$(".jianbook_cor").html()


	var index = layer.load();
      $.ajax({
			type : "POST",
			dataType : "json",
			cache : true,
			url : "../inc/ajax.asp?act=comment",
		     data: $("#cform").serialize(),
			error:function(){alert("fail");},
            success:function(data)
	           {
		   if(data.status=='y')
				{
           parent.location.href=data.url;
				}
				else{
				layer.msg(data.info)
				  layer.close(index);
				
				}
		
	}
	
	});
	
	
 })  

});
  function fjclose(obj){

 var my_id=$(obj).prev("input[name=fujian]").val()


$.ajax({
			type : "POST",
			cache : true,
			dataType : "json",
			url : "../inc/ajax.asp?act=dell_file",
			data:{"id":my_id},
			error:function(){alert("fail");},
            success:function(data){}
	
	});
	$(obj).parents(".upload-file").remove(); 	 
	 
	 }	

  
    </script>

  <%=jianbook.jcount(2)%>
</body>
</html>
